package com.liming.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author liming
 * @date 2025/4/14
 */
@Getter
@AllArgsConstructor
public enum RefundChannelEnum {

    //订单退款渠道：
    //ORIGINAL: 原路退款，
    //BALANCE: 退回到余额，
    //OTHER_BALANCE: 原账户异常退到其他余额账户，
    //OTHER_BANKCARD: 原银行卡异常退到其他银行卡(发起异常退款成功后返回)。

    ORIGINAL(1, "ORIGINAL", "原路退款"),
    BALANCE(2, "BALANCE", "退回到余额"),
    OTHER_BALANCE(3, "OTHER_BALANCE", "原账户异常退到其他余额账户"),
    OTHER_BANKCARD(4, "OTHER_BANKCARD", "原银行卡异常退到其他银行卡");

    private final Integer code;
    private final String name;
    private final String desc;

    public static Integer getCodeByName(String name) {
        for (RefundChannelEnum value : values()) {
            if (value.getName().equals(name)) {
                return value.getCode();
            }
        }
        return null;
    }
}
